<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>出库列表</title>
    <link rel="stylesheet" href="../dist/css/toastr.min.css" >
    <link rel="stylesheet" href="../dist/css/bootstrap.css">
    <link rel="stylesheet" href="../dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="../dist/css/ladda/ladda-themeless.min.css">
    <link rel="stylesheet" href="../dist/css/sweetalert.css">
    <link rel="stylesheet" href="../dist/css/index_public.css">
    <link rel="stylesheet" href="../dist/css/warehousingList.css">
</head>
<body>
  <div class="container-fluid">
    <!-- header  -->
    <div class="nav row " id="loadHeader"></div>
    <div class="row neirong" >
      <!-- 侧边导航 -->
      <div id="div1" class="sidebar col-xs-2"></div>
      <!-- 主题内容 -->
      <div class="main col-xs-10 row animated fadeInRight" style="min-height:800px;background-color:#F4F7FE;padding:15px 0;">
        <div id="companyInfoDiv" class="col-xs-12">
          <div class="wareList-wrapper">
            <div class="wareList-head">
              <span class="wareList-head-tit">出库列表</span>
              <span class="wareList-head-add"></span>
            </div>
            <ul class="wareList-nav">
              <li class="wareList-nav-items">
                <span class="wareList-nav-items-t1">筛选查询</span>
                <!-- <div class="wareList-nav-items-hide">
                  <i class="wareList-nav-items-hide-icon glyphicon glyphicon-chevron-down"></i>
                  <span class="wareList-nav-items-t2">收起筛选</span>
                </div>
                <span class="wareList-nav-items-t3">查询结果</span> -->
              </li>
              <li class="wareList-nav-items-cons">
                <!-- <div class="wareList-nav-items-con">
                  <span>种类:</span>
                  <select class="wareList-nav-items-con-zl">
                    <option value=0>1号仓库</option>
                    <option value=1>1号仓库</option>
                  </select>
                </div> -->
                <div class="wareList-nav-items-con">
                  <span>仓库:</span>
                  <select class="wareList-nav-items-con-ck form-control"></select>
                </div>
                <div class="wareList-nav-items-con">
                  <span>产品名称:</span>
                  <!-- <select class="wareList-nav-items-con-ss"></select> -->
                  <input type="text" class="wareList-nav-items-con-ss form-control" />
                  <i class="wareList-nav-items-con-search glyphicon glyphicon-search"></i>
                </div>
              </li>
            </ul>
            <div class="wareList-content">
              <div class="wareList-content-head">
                <span class="wareList-content-head-name">出库列表</span>
                <!-- <div class="wareList-content-head-num">
                  <div class="wareList-content-head-show">
                    <span>显示条数</span>
                    <i class="wareList-content-head-icon glyphicon glyphicon-chevron-down"></i>
                  </div>
                  <select class="wareList-content-show-num" value="20">
                    <option value="20">20</option>
                    <option value="50">50</option>
                    <option value="100">100</option>
                  </select>
                </div> -->
              </div>
              <div class="wareList-content-nav">
                <span>编号</span>
                <span>产品名称</span>
                <span>产品种类</span>
                <span>出库量</span>
                <span>出库合格率</span>
                <span>仓库名称</span>
                <span>出库时间</span>
                <span>操作人</span>
              </div>
              <div class="wareList-content-con-wra">
                <!-- <div class="wareList-content-con">
                  <span class="wareList-content-con-index">
                    <input type="checkbox" name="" value="">
                  </span>
                  <span>100001</span>
                  <span>大麦</span>
                  <span>粮食</span>
                  <span>983</span>
                  <span>100%</span>
                  <span>1号仓库</span>
                  <span>2018-08-08</span>
                  <span>吕珊珊</span>
                </div> -->
              </div>
            </div>
            <div class="wareList-foot">
              <!-- 底部 分页 -->
              <div class="M-box1"></div>
            </div>

            <div class="addWare-wra" style="display: none;">
              <div class="addWare">
                <div class="addWare-head">
                  <span>新增出库</span>
                  <div class="addWare-head-close-wra">
                    <i class="addWare-head-close glyphicon glyphicon-remove"></i>
                  </div>
                </div>
                <ul class="addWare-items">
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      产品名称
                    </div>
                    <div class="addWare-item-cons">
                      <!-- <input class="addWare-item-con addWare-name" type="text" placeholder="请输入玉米"> -->
                      <select class="addWare-item-con addWare-name"></select>
                    </div>
                  </li>
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      产品种类
                    </div>
                    <div class="addWare-item-cons addWare-item-cons-type">
                      <!-- <select class="addWare-item-con" value="请选择产品种类">
                        <option value="0">1</option>
                      </select> -->
                      <input class="addWare-item-con addWare-type" type="text" />
                    </div>
                  </li>
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      出库量
                    </div>
                    <div class="addWare-item-cons">
                      <input class="addWare-item-con addWare-num" type="number" placeholder="例如：请输入1000斤">
                    </div>
                  </li>
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      合格率
                    </div>
                    <div class="addWare-item-cons">
                      <input class="addWare-item-con addWare-qualified" type="text" placeholder="请输入">
                    </div>
                  </li>
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      入库时间
                    </div>
                    <div class="addWare-item-cons">
                      <input class="addWare-item-con addWare-time" id="add_time" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm', readOnly: true});" format="yyyy-MM-dd HH:mm"  type="text" placeholder="请输入时间">
                    </div>
                  </li>
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      仓库
                    </div>
                    <div class="addWare-item-cons">
                      <select class="addWare-item-con addWare-ware"></select>
                    </div>
                  </li>
                  <li class="addWare-item">
                    <div class="addWare-item-title">
                      <i>*</i>
                      操作员
                    </div>
                    <div class="addWare-item-cons">
                      <select class="addWare-item-con addWare-oper"></select>
                    </div>
                  </li>
                </ul>
                <div class="addWare-mange">
                  <div class="addWare-mange-cancel addWare-mange-op">
                    <i class="glyphicon glyphicon-floppy-remove"></i>
                    <span>取消</span>
                  </div>
                  <div class="addWare-mange-confirm addWare-mange-op">
                    <i class="glyphicon glyphicon-floppy-saved"></i>
                    <span>确定</span>
                  </div>
                </div>
              </div>
            </div>

          </div>
        </div>
        <!-- 11.17 -->
        <!-- <div class="M-box1 col-xs-12" style="text-align:right;">
          456
        </div> -->
      </div>
    </div>
    <div class="row" id="divFooter"></div>
  </div>
  <div class="modal fade" id="personal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"></div>

  <script type="text/javascript" type="text/javascript" src="../dist/js/jquery-1.9.1.min.js"></script>
  <script type="text/javascript" type="text/javascript" src="../dist/js/widgets/jquery.nicescroll.min.js"></script>
  <script type="text/javascript" src="../dist/js/widgets/toastr.min.js"></script>
  <script type="text/javascript" type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=sjnEPnWsuqC8nnOea4HMNQkUqK3TGBmu"></script>
  <script type="text/javascript" src="../dist/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="../dist/js/widgets/webuploader.min.js"></script>
  <script type="text/javascript" src="../dist/js/widgets/jquery.pagination.js"></script>
  <script type="text/javascript" src="../dist/js/widgets/toastr.min.js"></script>
  <script type="text/javascript" src="../dist/js/widgets/sweetalert.min.js"></script>
  <script type="text/javascript" src="../dist/js/My97DatePicker_ie9/WdatePicker.js"></script>
  <script type="text/javascript" src="../dist/js/js/comm.js"></script>
  <script type="text/javascript" src="../dist/js/js/index_head_left.js"></script>
  <script type="text/javascript">
      $(document).ready(function(){

        // 获取登陆信息
        var loginInfo = JSON.parse(sessionStorage.getItem("loginInfo"));

        $("#div1").load('../include/left_title.html',function(){
          menu();
        })
        $("#loadHeader").load("../include/header.html",function(){
          header();
        })
        $("#personal").load("../include/modelpersonal.html",function(){
          personalModel();
        })

        var page = 1;
        var pageSize = 10;

        // 改变仓库
        $(".wareList-nav-items-con-ck").on("change", function() {
          page = 1;
          var id = $(this).val();
          $(".wareList-nav-items-con-ss").val("");
          showList(id, "");
          showListCount(id, "");
        })

        // 搜索产品名称
        $(".wareList-nav-items-con-search").on("click", function() {
          page = 1;
          var id = $(".wareList-nav-items-con-ck").val();
          var name = $(".wareList-nav-items-con-ss").val();
          showList(id, name);
          showListCount(id, name);
        })

        wareInit();
        // ----------------------------------------------------
        function wareInit() {
          $.ajax({
            url: URLAPI + "warehouseInterface",
            data: {
              'actionName': 'warehouseService',
              'method': 'frontWareHouseList',
              'userType': 3,
              'companyId': loginInfo.id,
              "token": getCookie("token")
            },
            daraType: "json",
            type: "post",
            success: function(msg) {
              console.log(msg);
              if (msg.statusCode == 1) {
                var str = '<option value=""> == 请选择 == </option>';
                msg.result.forEach(function(item, index) {
                  str += '<option value="'+item.id+'">'+item.warehouse_name+'</option>';
                })
                $(".wareList-nav-items-con-ck").html(str);
                showList();
                showListCount()
              } else {
                toastr.error('查询仓库数据失败','请联系管理员');
              }
            }
          })
        }

        function showList(id, name) {
          var id,name;
          if (!id) id = "";
          if (!name) name = "";
          $.ajax({
            url: URLAPI + "warehouseInterface",
            data: {
              "actionName": "warehouseService",
              "method": "insertWarehousesList",
              "warehouseId": id,
              "name": name,
              "ioType": 2,
              "page": page,
              "pageSize": pageSize,
              "companyId": loginInfo.id,
              "token": getCookie("token")
            },
            dateType: "json",
            type: "post",
            success: function(msg) {
              if (msg.statusCode == 1) {
                if (msg.result.length == 0){
                  $(".wareList-content-con-wra").html("");
                  return false;
                }
                var str = '';
                msg.result.forEach(function(item) {
                  str += '<div class="wareList-content-con">'
                          +'<span>'+item.id+'</span>'
                          +'<span>'+item.name+'</span>'
                          +'<span>'+item.typeName+'</span>'
                          +'<span>'+item.size+'</span>'
                          +'<span>'+item.qualified+'</span>'
                          +'<span>'+item.displayName+'</span>'
                          +'<span>'+item.create_time.substr(0,16)+'</span>'
                          +'<span>'+loginInfo.name+'</span>'
                        +'</div>';
                })
                $(".wareList-content-con-wra").html(str);
              } else {
                toastr.error('查询仓库入库数据失败','请联系管理员');
              }
            }
          })
        }

        function showListCount(id, name) {
          var id,name;
          if (!id) id = "";
          if (!name) name = "";
          $.ajax({
            url: URLAPI + "warehouseInterface",
            data: {
              "actionName": "warehouseService",
              "method": "insertWarehousesCount",
              "warehouseId": id,
              "name": name,
              "ioType": 2,
              "page": page,
              "pageSize": pageSize,
              "companyId": loginInfo.id,
              "token": getCookie("token")
            },
            dateType: "json",
            type: "post",
            success: function(msg) {
              if (msg.statusCode == 1) {
                // 分页
                if(msg.result) $(".M-box1").show();
                $('.M-box1').pagination({
                    totalData: msg.result,  //数据总条数
                    showData: pageSize,   //每页显示的条数
                    coping: false,
                    current: page,      //当前第几页
                    prevContent: "上一页",	//上一页内容
                    nextContent: "下一页",	//下一页内容
                    jumpBtn: "确定",
                    callback: searchWare
                });
              }
            }
          })
        }

        function searchWare(msg) {
          page = msg.getCurrent();
          var id = $(".wareList-nav-items-con-ck").val();
          var name = $(".wareList-nav-items-con-ss").val();
          showList(id, name);
        }
      });
    </script>
</body>
</html>
